package com.jvyou.framework.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jvyou.framework.domain.entity.Menu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 菜单权限表(Menu)表数据库访问层
 *
 * @author 橘柚
 * @since 2025-05-29 17:25:16
 */
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("SELECT DISTINCT m.perms FROM sys_menu m LEFT JOIN sys_role_menu rm ON m.id=rm.menu_id LEFT JOIN sys_user_role ur ON rm.role_id=ur.role_id WHERE ur.user_id=#{userId} AND m.status='0' AND m.perms IS NOT NULL AND is_deleted='0'")
    List<String> getPermissionByUserId(Long id);
}
